rm(list=ls())

# Script to run QAP
library(sna)

# Load the followers adjacency matrix
y <- readRDS("processed_data/followers_adjacencyMatrix.Rds")
# Load the predicting matrix 
load("processed_data/QAP_predicting_matrices_2.RData")

# Non Parallel implementation to run QAP
start.time <- Sys.time()
# Set seed value 
seed_value <- 35
set.seed(seed_value)
# Run netlm
qap_res <- netlogit(y, predicting_matrices, reps = 5)
end.time <- Sys.time()
time.taken <- end.time - start.time
time.taken

# Save results 
file_name <- paste0("output/qap_res_followers_out", seed_value, ".Rds")
saveRDS(qap_res, file=file_name)